package com.gmail.blackdog1987.onedollar.dao;

import com.gmail.blackdog1987.onedollar.dao.hibernate.EntityHibernateDao;
import com.gmail.blackdog1987.onedollar.dao.hibernate.jdbc.BaseJdbcDao;
import com.gmail.blackdog1987.onedollar.dao.hibernate.jdbc.JdbcUtil;
import com.gmail.blackdog1987.onedollar.entity.AppAdEntity;
import com.gmail.blackdog1987.onedollar.entity.TAlipayCallbackEntity;
import com.gmail.blackdog1987.onedollar.entity.base.Page;
import com.gmail.blackdog1987.onedollar.vo.GoodsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository("alipayCallbackDao")
public class AlipayCallbackDao extends EntityHibernateDao<TAlipayCallbackEntity> {
    @Autowired
    private BaseJdbcDao baseJdbcDao;

    public int check(String orderid, String subject, String notifyid) {
        return baseJdbcDao.getJdbcTemplate().queryForInt(" select count(1) from t_alipay_callback where notify_id = ? or (`subject` = ? and trade_no = ?) ", new Object[]{notifyid, subject, orderid});
    }

    public int check(String notifyid) {
        return baseJdbcDao.getJdbcTemplate().queryForInt(" select count(1) from t_alipay_callback where notify_id = ? ", new Object[]{notifyid});
    }
}
